﻿
#region Usings

#endregion

namespace LongNet.Util.Math
{
    /// <summary>
    /// Conversion helper
    /// </summary>
    public class Conversion
    {
        #region Public Static Function

        /// <summary>
        /// Celsius to Fahrenheit
        /// </summary>
        /// <param name="Value">Celsius value</param>
        /// <returns>Equivalent Fahrenheit temp</returns>
        public static double CelsiusToFahrenheit(double Value)
        {
            return ((Value * 9) / 5) + 32;
        }

        /// <summary>
        /// Celsius to Kelvin
        /// </summary>
        /// <param name="Value">Celsius value</param>
        /// <returns>Equivalent Kelvin temp</returns>
        public static double CelsiusToKelvin(double Value)
        {
            return Value + 273.15;
        }

        /// <summary>
        /// Fahrenheit to Celsius
        /// </summary>
        /// <param name="Value">Fahrenheit value</param>
        /// <returns>Equivalent Celsius value</returns>
        public static double FahrenheitToCelsius(double Value)
        {
            return ((Value - 32) * 5) / 9;
        }

        /// <summary>
        /// Fahrenheit to Kelvin
        /// </summary>
        /// <param name="Value">Fahrenheit value</param>
        /// <returns>Equivalent Kelvin value</returns>
        public static double FahrenheitToKelvin(double Value)
        {
            return ((Value + 459.67) * 5) / 9;
        }

        /// <summary>
        /// Kelvin to Celsius
        /// </summary>
        /// <param name="Value">Kelvin value</param>
        /// <returns>Equivalent Celsius value</returns>
        public static double KelvinToCelsius(double Value)
        {
            return Value - 273.15;
        }

        /// <summary>
        /// Kelvin to Fahrenheit
        /// </summary>
        /// <param name="Value">Kelvin value</param>
        /// <returns>Equivalent Fahrenheit value</returns>
        public static double KelvinToFahrenheit(double Value)
        {
            return ((Value * 9) / 5) - 459.67;
        }

        #endregion
    }
}
